package com.jeeplus.modules.guide.mapper;

import com.jeeplus.modules.guide.model.domain.Appointment;
import com.jeeplus.modules.guide.model.domain.AppointmentRecord;
import com.jeeplus.modules.guide.model.domain.BusinessInfo;
import com.jeeplus.modules.guide.model.vo.AppointmentRecordOut;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * ClassName: AppointmentRecordMapper
 * Function:  预约记录
 * Date:      2021/6/8 21:30
 *
 * @author hanKongbin
 * version    V1.0
 */
@Mapper
@Repository
public interface AppointmentRecordMapper {

    /**
     * 查询预约记录
     *
     * @param sysNo
     * @param businessId
     * @return
     */
    List<AppointmentRecord> queryAppointmentRecords(@Param("sysNo") String sysNo, @Param("businessId") String businessId, @Param("workday") List<String> workday, @Param("timePeriod") Integer timePeriod);

    /**
     * 查询已预约记录
     *
     * @param sysNo
     * @param businessId
     * @return
     */
    List<AppointmentRecord> queryAppointmentRecordsCount(@Param("sysNo") String sysNo, @Param("businessId") String businessId, @Param("time") String time, @Param("timePeriod") Integer timePeriod);


    /**
     * 查询当前身份证id预约记录
     *
     * @param cardId
     * @param time
     * @param businessId
     * @return
     */
    List<AppointmentRecord> queryRecordsByCardId(@Param("cardId") String cardId, @Param("time") String time, @Param("businessId") String businessId, @Param("timePeriod") Integer timePeriod);

    /**
     * 查询当前身份证id预约记录
     *
     * @return
     */
    List<AppointmentRecordOut> queryRecordsByTell(@Param("tell") String tell);


    /**
     * 保存预约记录
     *
     * @param appointment
     * @return
     */
    int save(Appointment appointment);

    /**
     * 获取业务详情
     *
     * @param businessId
     * @return
     */
    List<BusinessInfo> queryBusiness(@Param("businessId") List<String> businessId);

    /**
     * 获取业务详情
     *
     * @param businessId
     * @return
     */
    BusinessInfo queryBusinessById(@Param("businessId") String businessId);

    /**
     * 取消预约
     *
     * @param id
     * @return
     */
    int delete(@Param("id") String id);

    /**
     * 查询当前身份证id是否有当前时间段预约记录
     *
     * @param cardId
     * @param time
     * @param timeperiod
     * @return
     */
    Integer queryRecordsByCardIdAndTime(@Param("cardId") String cardId, @Param("time") String time, @Param("timeperiod") Integer timeperiod);

}
